//
//  MKUIThemeCenter+Test.m
//  MKUITestApp
//
//  Created by 苏尚进 on 2021/3/30.
//  Copyright © 2021 moon. All rights reserved.
//

#import "MKUIThemeCenter+Test.h"
#import "TestThemeDark.h"
#import "TestThemeLight.h"
#import "TestThemeNormal.h"
#import "TestThemeVip.h"
#import "TestThemeGray.h"

@implementation MKUIThemeCenter (Test)

+ (void)test_setupThemes{
    [MKUIThemeCenter sharedInstance].themes = @[
        [TestThemeNormal new],
        [TestThemeVip new],
        [TestThemeGray new],
    ];
    
    [MKUIThemeCenter sharedInstance].defaultThemeIndex = 0;
    [MKUIThemeCenter sharedInstance].currentThemeIndex = [[NSUserDefaults standardUserDefaults] integerForKey:@"test_current_theme_index"];
    
    [[NSNotificationCenter defaultCenter] addObserverForName:kMKUIThemeUpdateNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
        [MKUIThemeCenter test_saveTheme];
    }];
}
+ (void)test_saveTheme{
    [[NSUserDefaults standardUserDefaults] setInteger:[MKUIThemeCenter sharedInstance].currentThemeIndex forKey:@"test_current_theme_index"];
}
@end
